= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 A u t h o r :   Y o u n g w o o k   K i m   ( K o r e a n ) 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 C o n t a c t :   r u m i a 0 6 0 1 @ g m a i l . c o m 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
   T  ̬  -   hT
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
  ,   MѤ¸   D̲,   ĳD  T  Xՠ.   H P     Ť ?   ̹}  H P X  \ t      $  ֬  H P   ̹t  \t,   t  P  pt0|  %XՔ     l´  )@  4x ? 
 
 
 
 . .   i m a g e : :   A d v a n c e d O u t p u t P r o c e s s 1 . g i f 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   3 2 0 ,   2 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " A d v a n c e d O u t p u t P r o c e s s 1 . g i f " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 . .   i m a g e : :   A d v a n c e d O u t p u t P r o c e s s 2 . g i f 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   3 2 0 ,   2 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " A d v a n c e d O u t p u t P r o c e s s 2 . g i f " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 . .   i m a g e : :   A d v a n c e d O u t p u t P r o c e s s 3 . g i f 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   3 2 0 ,   2 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " A d v a n c e d O u t p u t P r o c e s s 3 . g i f " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 X  t  `  Lȹ  MѤ¸|    T  X0̹  Xt  .   X  @  Ż   ?   @  E v e n t 8  t踴.   ( ܴ      DŘ|    H P |  pXՌ  X . )   t  ٳ|\  )t.   X̹,   tǃ@  Ȉ  MѤ¸t.   D  ̈́  T    JŔ.   t  pt0D  Ż  T  8XՌ  T  `L?     =  Dt|  0,    .   H P     t,   ō  D   \,   DŘ@  t  %     . 
 
 
 
 . .   i m a g e : :   A d v a n c e d O u t p u t P r o c e s s 4 . g i f 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   3 2 0 ,   2 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " A d v a n c e d O u t p u t P r o c e s s 4 . g i f " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 . .   i m a g e : :   A d v a n c e d O u t p u t P r o c e s s 5 . g i f 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   3 2 0 ,   2 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " A d v a n c e d O u t p u t P r o c e s s 5 . g i f " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 . .   i m a g e : :   A d v a n c e d O u t p u t P r o c e s s 6 . g i f 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   3 2 0 ,   2 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " A d v a n c e d O u t p u t P r o c e s s 6 . g i f " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 ,  DL.     \@  # 6 D  UxXt  .   \@  X.   < ,   p  @    ɬD  .     L,   ֬  H P D  08  @  h    ɬD  0     \   ̹|  .   ȹɹ<\,   @  ɬ  XՀ  LP|  .   p y g a m e . d r a w . r e c t   h   X  \  4 X         D  Ux`    ǔp  ( ̈    ΄  t,   P      ,   $    Pخ  t. )   t  4 X    X  ĳ   4xɔ    $XՔ  ,     D  Xt  UxXՔ  t     }  tt`    .   3 X  t  2 0 |  L  X՘X    ̹D  1 0   3 0 <\  ԯ  D|! 
 
 
 
 ,   tȔ  <\  hT|  t|  \.   A l w a y s 8  E v e n t 8D  m a i n h  XŔp,   t    m a i n h|  \t  >D    ĳ]  # 7    x  ̬|  t|  \.     L  d r a w H P |  \  h|  ̹.   X  hT  DtŔ  G U I   \D  ̹  LX  hT  Dt@  lЌ  t  J.   |  t,   X՘X  |  %XՔ  X՘X  %  h|    ̹䴴  P  t  D  t.   <`,   X     %     \|  XՔ  @  Tt  ȴ|  x`  L   |  `  t. 
 
 
 
 < 8  Tܴ>   : : 
 
 
 
         i m p o r t   p y g a m e ,   s y s 
 
         f r o m   p y g a m e . l o c a l s   i m p o r t * 
 
         
 
         m a x H P   =   1 0   
 
         w h i t e   =   ( 2 5 5 , 2 5 5 , 2 5 5 ) 
 
         g r a y   =   ( 1 2 7 , 1 2 7 , 1 2 7 ) 
 
         b l a c k   =   ( 0 , 0 , 0 ) 
 
         r e d   =   ( 2 5 5 , 0 , 0 ) 
 
         g r e e n   =   ( 0 , 2 5 5 , 0 ) 
 
         b l u e   =   ( 0 , 0 , 2 5 5 ) 
 
         p y g a m e . i n i t ( ) 
 
         p y g a m e . d i s p l a y . s e t _ c a p t i o n ( " H P   b a r   P r o j e c t " ) 
 
         w i d t h   =   6 4 0   # 1 
 
         h e i g h t   =   4 8 0   # 2 
 
         m y S c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( ( w i d t h ,   h e i g h t ) ) 
 
         m y T e x t F o n t   =   p y g a m e . f o n t . F o n t ( " H o o n W h i t e c a t R . t t f " ,   3 2 ) 
 
         m y T e x t   =   m y T e x t F o n t . r e n d e r ( ( s t r ( m a x H P )   +   " / "   +   s t r ( m a x H P ) ) ,   T r u e ,   r e d ,   g r a y ) 
 
         m y T e x t A r e a   =   m y T e x t . g e t _ r e c t ( ) 
 
         m y T e x t A r e a . c e n t e r   =   ( w i d t h / 2 ,   h e i g h t / 2 )   # 3 
 
         f p s C l o c k   =   p y g a m e . t i m e . C l o c k ( ) 
 
         
 
         d e f   m a i n ( ) :   # 4 
 
                 H P   =   5 
 
                 
 
                 w h i l e   T r u e : 
 
                         m y T e x t   =   m y T e x t F o n t . r e n d e r ( ( s t r ( H P )   +   " / "   +   s t r ( m a x H P ) ) ,   T r u e ,   r e d ,   g r a y ) 
 
                 
 
                         m y S c r e e n . f i l l ( g r a y ) 
 
         
 
                         m y S c r e e n . b l i t ( m y T e x t ,   m y T e x t A r e a ) 
 
                         d r a w H P ( H P )   # 5 
 
         
 
                         f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                                 i f   e v e n t . t y p e   = =   Q U I T : 
 
                                         p y g a m e . q u i t ( ) 
 
                                         s y s . e x i t ( ) 
 
                                 e l i f   e v e n t . t y p e   = =   K E Y D O W N : 
 
                                         i f   e v e n t . k e y   = =   K _ U P : 
 
                                                 i f   H P   ! =   1 0 : 
 
                                                         H P   =   H P   +   1 
 
                                         e l i f   e v e n t . k e y   = =   K _ D O W N : 
 
                                                 i f   H P   ! =   0 : 
 
                                                         H P   =   H P   -   1 
 
                 
 
                         p y g a m e . d i s p l a y . u p d a t e ( ) 
 
                         f p s C l o c k . t i c k ( 6 0 ) 
 
         
 
         d e f   d r a w H P ( H P ) :   # 6 
 
                 r   =   i n t ( ( h e i g h t   -   4 0 )   /   m a x H P ) 
 
         
 
                 p y g a m e . d r a w . r e c t ( m y S c r e e n ,   b l a c k ,   ( 2 0 ,   2 0 ,   2 0 ,   2 0   +   ( ( m a x H P   -   0 . 5 )   *   r ) ) ) 
 
         
 
                 f o r   i   i n   r a n g e ( m a x H P ) : 
 
                         i f   H P   > =   ( m a x H P   -   i ) : 
 
                                 p y g a m e . d r a w . r e c t ( m y S c r e e n ,   r e d ,   ( 2 0 ,   2 0   +   ( i   *   r ) ,   2 0 ,   r ) ) 
 
                         p y g a m e . d r a w . r e c t ( m y S c r e e n ,   w h i t e ,   ( 2 0 ,   2 0   +   ( i   *   r ) ,   2 0 ,   r ) ,   1 ) 
 
         
 
                 r e t u r n 
 
         
 
         i f   _ _ n a m e _ _   = =   ' _ _ m a i n _ _ ' :   # 7 
 
                 m a i n ( ) 
 
         